<template>
	<view class="content paddingtb">
		<!-- 店鋪列表 -->
		<view class="flexcenter" v-if="!list.data.length">
			<view class="placeholderimage" style="margin-top: 100rpx;" ></view>
		</view>
		<view class="mainpadding ffffff margin_bottom3 border12 positionr" v-for="(item,index) in list.data" :key="item.id" @click="goShopInfo(item.shop.id,item.shop)">
			<view class="flex">
				<image class="shopImg margin_right2" :src="item.shop.logoimage_text" mode=""></image>
				<view class="flex1">
					<view class="color_ling text_g">{{item.shop.name}}</view>
					<view class="flexbetween" @click.stop="jumpdetail(item)">
						<view class="margin_top hong_text">餘額：{{item.money}}</view>
						<view class="listbtnhuang">儲值詳情</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			jumpdetail(item){
				uni.navigateTo({
					url:'/pages_mine/chuzhixq?id='+item.shop.id+"&allmoney="+item.money
				})
			},
			init(isPage, page) { //提現記錄
				let _this = this;
				httpRequest.request('/api/rechargecl/userCard', 'GET', {
					page: page || 1,
					limit: _this.limit,
					shop_id:uni.getStorageSync("shop_id"),
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			goShopInfo(id, item) { //店鋪詳情
				if (item.is_goole == 1) {
					uni.navigateTo({
						url: "/pages_index/shopInfogoogle?id=" + id
					})
					return false
				}
				uni.setStorageSync("shop_id", id)
				uni.navigateTo({
					url: "/pages_index/shopInfo?id=" + id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	// 店鋪
	.shopImg {
		width: 94rpx;
		height: 94rpx;
		min-width: 94rpx;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
	}

	.faRadius {
		width: 7rpx;
		height: 7rpx;
		background-color: #000000;
		border-radius: 50%;
	}

	.shopItemImg {
		width: 24rpx;
		height: 24rpx;
		margin-right: 5rpx;
	}

	.scrollBox {
		padding-left: 100rpx;

		.goodsImg {
			width: 164rpx;
			height: 122rpx;
			border-radius: 10rpx 10rpx 10rpx 10rpx;
		}
	}

	// 遮罩层
	.black_bg {
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.3);
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		position: absolute;
		left: 0;
		top: 0;
		z-index: 90;
	}

	// 取消收藏
	.cancelCollect {
		width: 132rpx;
		height: 132rpx;
		background: #FFFFFF;
		border-radius: 50%;
		position: absolute;
		left: 50%;
		top: 50%;
		z-index: 99;
		transform: translate(-50%, -50%);
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		.cancelCollectImg {
			width: 40rpx;
			height: 38rpx;
		}
	}
</style>